package fr.upmc.cie.data;

import android.content.Context;
import fr.upmc.cie.data.dbaccess.DBCategorie;
import fr.upmc.cie.data.dbaccess.DBChannel;
import fr.upmc.cie.data.dbaccess.DBProvider;
import fr.upmc.cie.data.dbaccess.DBTicket;

public abstract class DataManager {
	
	private static ChannelManager channelManager;
	private static CategorieManager categorieManager;
	private static TicketManager ticketManager;

	/**
	 * Obtenir ChannelManager unique
	 * @param context
	 * @return
	 */
	public static ChannelManager getChannelManager(Context context){
		if (channelManager==null)
			channelManager = new ChannelManager(new DBChannel(DBProvider.getDB(context)));
		return channelManager;
	}
	
	/**
	 * Obtenir CategorieManager unique
	 * @param context
	 * @return
	 */
	public static CategorieManager getCategorieManager(Context context){
		if (categorieManager==null)
			categorieManager = new CategorieManager(new DBCategorie(DBProvider.getDB(context)));
		return categorieManager;
	}
	
	/**
	 * Obtenir TicketManager unique
	 * @param context
	 * @return
	 */
	public static TicketManager getTicketManager(Context context){
		if (ticketManager==null)
			ticketManager = new TicketManager(new DBTicket(DBProvider.getDB(context)));
		return ticketManager;
	}
	
}
